package com.sm.chatinputlibrary.emoji;

import androidx.annotation.NonNull;

/**
 * 文本中需要替换的表情的范围及对应的表情
 * link{https://github.com/vanniktech/Emoji/blob/master/emoji/src/main/java/com/vanniktech/emoji/EmojiRange.java}
 */
public class EmojiRange {
    public final int start;
    public final int end;
    public final EmojiBean emoji;

    public EmojiRange(int start, int end, @NonNull EmojiBean emoji) {
        this.start = start;
        this.end = end;
        this.emoji = emoji;
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        final EmojiRange that = (EmojiRange) o;
        return start == that.start && end == that.end && emoji.equals(that.emoji);
    }

    @Override
    public int hashCode() {
        int result = start;
        result = 31 * result + end;
        result = 31 * result + emoji.hashCode();
        return result;
    }
}
